<!DOCTYPE html>
<html lang="zh-CN" dir="ltr">
<head>
    <meta charset="UTF-8">
	<title>T-maker JAY's AP control mode</title>
	<link rel="stylesheet" href="style.css">
</head>
<body>
<center>
<div><img src="/img/Tmac.jpg" alt="菜鸟Maker麦杰" /></div>
<div id="demo">
<h1>菜鸟Maker麦杰的AP控制模式</h1> 
<button type="button" style="color:blue;width:100px;height:50px;font-size:30px" onclick="sendData1(1)">开灯 </button> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            
<button type="button" style="color:blue;width:100px;height:50px;font-size:30px" onclick="sendData1(0)">关灯</button>
</div>
<div style="font-size:30px">
    现在灯的状态是 : <span id="ledState">none </span><br>
</div>

<script>
function sendData1(led) {    //发送页面按键开关请求
  var xhttp = new XMLHttpRequest();       
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("ledState").innerHTML = //返回开关状态
      this.responseText;}
  };
  xhttp.open("GET", "setLED?LEDstate="+led, true);
  xhttp.send();
}
</script>
</center>
</body>
</html> 